package com.sskj.mine;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.common.base.HttpData;
import com.sskj.lib.bean.PageBean;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.lib.http.JsonConverter;
import com.sskj.mine.bean.BuyRecordBean;
import com.sskj.mine.bean.ShellRecordBean;
import com.sskj.mine.http.HttpConfig;
import com.sskj.mine.presenter.BasePresenter;

import java.util.List;

import io.reactivex.Flowable;

public class ShellRecordPresenter extends BasePresenter<ShellRecordFragment> {

        public Flowable<List<ShellRecordBean>> getRecordList(int p,int size) {
            return OkGo.<HttpData<PageBean<ShellRecordBean>>>post(HttpConfig.BASE_URL + HttpConfig.OUT_RECORD)
                    .params("page", p)
                    .params("size", size)
                    .converter(new JsonConverter<HttpData<PageBean<ShellRecordBean>>>() {
                    })
                    .adapt(new FlowableBody<>())
                    .map(i -> i.getData().getList());
        }
//        OkGo.<HttpData<List<ShellRecordBean>>>post(HttpConfig.BASE_URL + HttpConfig.SHELLRECORD)
//                .params("type", "cash")
//                .params("page", p)
//                .params("size", size)
//                .execute(new JsonCallBack<List<PageBean<ShellRecordBean>>>(this) {
//                    @Override
//                    public void onSuccess(Response<List<PageBean<ShellRecordBean>>> response) {
//                        HttpData body = response.body();
//                        if (body.status == HttpConfig.OK) {
//                            mView.updateUi(response.body().getData().getList());
//                        }
//                    }
//                });
//    }

}
